package com.fit.networkShop.pages;

import java.util.LinkedList;

import com.fit.networkShop.beans.ProductBean;
import com.fit.networkShop.interfaces.Product;
import com.fit.networkShop.interfaces.Purchase;
import com.fit.networkShop.interfaces.PurchaseItem;
import com.fit.networkShop.service.*;

import org.apache.tapestry5.annotations.*;
import org.apache.tapestry5.ioc.annotations.*;

public class EntryProduct
{

	@Property
	@Persist
	private Product product;
	
	@Inject
	private Products products;
	
	@SetupRender
	public void createObject() {
		product = new ProductBean();
		product.setPurchaseItem(new LinkedList<PurchaseItem>());
	}
	
	public void onSuccess() {
		products.save(product);
	}
}